package cn.com.sparkle.paxos.event;

public abstract class InstanceExecuteMaxPackageSizeEvent implements Event {
	public final static int MAX_PACKAGE_SIZE_CHANGE = 1;

	@Override
	public void event(Object... args) {
		int type = (Integer) args[0];
		switch (type) {
		case MAX_PACKAGE_SIZE_CHANGE:
			maxPackageSizeChange((Integer) args[1]);
			break;
		default:
			throw new RuntimeException("not supported argument:" + type);
		}
	}

	public final static void doMaxPackageSizeChangeEvent(
			EventsManager eventsManager, int curMaxPackageSize) {
		eventsManager.doEvent(InstanceExecuteMaxPackageSizeEvent.class,
				MAX_PACKAGE_SIZE_CHANGE, curMaxPackageSize);
	}

	public abstract void maxPackageSizeChange(int curMaxPackageSize);
}
